Imports System.Data.SqlClient
Public Class areasDAL
    Dim conexion As New conexion
    Public Function listarAreas() As DataTable
        Dim dt As New DataTable
        Dim cmd As SqlCommand = New SqlCommand()
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "sp_listarAreas"
        Try
            cmd.Connection = conexion.abrir()
            dt.Load(cmd.ExecuteReader())
            conexion.Cerrar()
            Return dt
        Catch ex As Exception
            Return dt
        End Try
    End Function


    Public Function BuscarAreas(ByVal busqueda As String) As DataTable
        Dim dt As New DataTable
        Dim cmd As SqlCommand = New SqlCommand()
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "sp_buscarAreas"
        Try
            cmd.Parameters.Add(New SqlParameter("@busqueda", SqlDbType.VarChar)).Value = busqueda
            cmd.Connection = conexion.abrir()
            dt.Load(cmd.ExecuteReader())
            conexion.Cerrar()
            Return dt
        Catch ex As Exception
            Return dt
        End Try
    End Function


End Class
